<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>开发调试平台</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="<%=path%>//manage/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$.ajax({
				url : root+'/produce/getFlag.action',
				method : 'post',
				dataType : 'json',
				success : function(data) {
					$.each(data,function(i,entity){
						$("#results").append("<font size='5'>"+entity.key+"</font>：" +
    						"<input type='text' id='flag"+i+"' style='width:360px;padding-right:10px;' value='"+entity.value+"' />" +
    						"<input type='button' id='btn"+i+"' value='change' style='width:80px;' key='"+entity.key+"' onclick='changeFlag("+i+");'/><br/>"
    					);
					});
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
		});
	
		function changeFlag(index){
			var key = $("#btn"+index).attr("key");
			var value = $("#flag"+index).val();
			$.ajax({
				url : root+'/produce/changeFlag.action',
				method : 'post',
				dataType : 'json',
				data:{'flagKey' : key,'flagValue':value},
				success : function(data) {
					
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
		}
		
		function queryUserInfo(){
			var keyWord = $("#loginKeyWord").val();
			$.ajax({
				url : root+'/produce/queryUserInfo.action',
				method : 'post',
				dataType : 'json',
				data:{'keyWord' : encodeURI(encodeURI(keyWord))},
				success : function(data) {
					$("#appResult").html(data);
				},
				error:function(err){
					if(err.responseText!='')
						$("#appResult").html(err.responseText);
					else
						alert("请求失败！");
				}
			});
		}
		
		function queryAppInfo(id){
		}
		
		function insertAttrOptions() {
			var type = $("#attrType").val();
			var options = $("#options").val();
			$.ajax({
				url : root+'/produce/insertAttrOptions.action',
				method : 'post',
				dataType : 'json',
				data:{'type':type,'options' : encodeURI(encodeURI(options))},
				success : function(data) {
					alert("添加成功");
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
		}
	</script>
	<style type="text/css">
		a { color: #385ea2;text-decoration: none; }
		a:hover { text-decoration: underline; }
		body {font-family:Tahoma, Arial, sans-serif;}
		fieldset {margin:10px auto;border:solid 1px;}
		legend {color:red;}
	</style>
  </head>
  
  <body>
  	<div id="navBtn">
	  	<a href="<%=path %>/login/quitLogin.action" title="退出内容管理后台" class="tooltip"><span class="ui-icon ui-icon-power"></span>退出</a>
	  	<a href="<%=path %>/errlog/all.html" title="查看所有日志" class="tooltip"><span class="ui-icon ui-icon-power"></span>查看所有日志</a>
	  	<a href="<%=path %>/errlog/err.html" title="查看错误日志" class="tooltip"><span class="ui-icon ui-icon-power"></span>查看错误日志</a>
  	</div>
  	<fieldset>
  		<legend>用户注册</legend>
  		<a href="<%=path %>/login/goEnterReg.action">企业注册</a>&nbsp;&nbsp;&nbsp;&nbsp;
  		<a href="<%=path %>/login/goPersonLogin.action">个人注册</a>
  	</fieldset>
  	<fieldset>
  		<legend>配置文件修改</legend>
  		<div id="results"></div>
  	</fieldset>
  	<fieldset>
  		<legend>查看应用信息</legend>
  		<label>登录账户匹配：</label><input id="loginKeyWord" /><input type="button" value="查询" onclick="queryUserInfo();">
  		<div id="appResult"></div>
  	</fieldset>
  	<fieldset>
  		<legend>属性列表项配置</legend>
  		<label>type：</label><input id="attrType" /><br>
  		<label>options：</label><input id="options"  size="200"/><br>
  		<input type="button" value="提交" onclick="insertAttrOptions();">
  	</fieldset>
  	<fieldset>
  		<legend>图片批量上传</legend>
  		<jsp:include page="upload.jsp"></jsp:include>
  	</fieldset>
  </body>
</html>
